package org.example.hrpc.rpc.message;

public enum ServiceStatus {
    /**
     * SUCCESS
     */
    SUCCESS((byte)1),
    /**
     * ERROR
     */
    ERROR((byte)2),
    /**
     * NOT FOUND
     */
    NOT_FOUND((byte)3);

    private final byte code;

    ServiceStatus(byte code) {
        this.code = code;
    }

    public byte getCode() {
        return code;
    }

    public static ServiceStatus getType(final byte code) {
        for(ServiceStatus serviceStatus:ServiceStatus.values()){
            if(serviceStatus.getCode() == code){
                return serviceStatus;
            }
        }
        return null;
    }

}
